package cn.zjj.org.domain;

import cn.zjj.basic.domain.BaseDomain;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Department extends BaseDomain {

    //编号
    private String sn;
    //部门名字
    private String name;
    //上级部门路径
    private String dirPath;
    //状态
    private Integer state;
    //部门领导id
    private Long manager_id;
    //1.每个部门需要一个领导对象
    private Employee manager;
    //上级部门id
    private Long parent_id;
    //2.每个部门需要一个上级部门对象
    private Department parent;
    //3.每个部门有对应的子集部门  一对多(new一个防止不使用时空指针异常)
    //部门树最后一级没有数据就不显示
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<Department> children= new ArrayList<>();
}
